import 'package:flutter/material.dart';

import 'text_subscript.dart';

/// FileName number_subscript
///
/// @Author lax
/// @Date 2024/6/17
///
/// @Description 角标

class NumberSubscript extends TextSubscript {
  NumberSubscript({
    super.key,
    int? number,
    int? maxCount = 99,
    super.style,
    super.margin,
    super.padding,
    super.color = Colors.red,
  }) : super(
            width: number == null
                ? null
                : number > 99
                    ? 28
                    : number > 9
                        ? 24
                        : 16,
            height: 16,
            text: (number == null || number <= 0)
                ? null
                : (maxCount == null
                    ? number.toString()
                    : (number > maxCount ? '$maxCount+' : number.toString())));
}
